<?php
if (!defined("_INDEX")) { header("Location: /"); die; }

$cid = $route->GET('cid');
$address = UV::readMQ(strip_tags($route->POST('address')));
$phone = UV::readMQ(strip_tags($route->POST('phone')));

$city = $db->getCell("select `city_id` from `companies` where `company_id` = '$cid' limit 1");

$query = "insert into `additional_office` values (NULL,'$cid','$city','$address','$phone')";
$update = $db->sendQuery($query);
if ($update)
	goToPage("/admin/offices/?cid=$cid&add=success");
else
	goToPage("/admin/offices/?cid=$cid&add=fail");

?>